<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="com.st.mall.user.model.UserModel"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>开头</title>
</head>
<body>
	<header>
		<div class="top center">
			<div class="left fl">
				<ul>
					<li><a href="./index.jsp" target="_blank">首页</a></li>
					<li>|</li>
					<li><a href="">福利中心</a></li>
					<li>|</li>
					<li><a href="">工具大全</a></li>
					<li>|</li>
					<li><a href="">藏宝阁</a></li>
					<li>|</li>
					<li><a href="">交友平台</a></li>
					<li>|</li>
					<li><a href="">碎片系统</a></li>
					<li>|</li>
					<li><a href="">百闻牌</a></li>
					<li>|</li>
					<li><a href="">妖怪屋</a></li>
					<li>|</li>
					<li><a href="">Select Region</a></li>
					<div class="clear"></div>
				</ul>
			</div>
			<div class="right fr">
				<div class="gouwuche fr">
					<a href="./shoppingcart.jsp">购物车</a>
				</div>
				<div class="fr">
					<ul>
						<%
							Object obj = session.getAttribute("user");
						if (obj == null) {
						%>
						<li><a href="./login.jsp">登录</a></li>
						<li>|</li>
						<li><a href="./reg.jsp">注册</a></li>
						<%
							} else {
							UserModel user = (UserModel) obj;
						%>
						<li><a href="javascript:dingdan()">用户[<%=user.getName()%>]
						</a></li>
						<li>|</li>
						<li><a href="javascript:toLogout()">注销</a></li>
						<%
							}
						%>
					</ul>
				</div>
				<div class="clear"></div>
			</div>
			<div class="clear"></div>
		</div>
	</header>
	
		<div class="banner_x center">
			<a href="./index.jsp" target="_blank"><div class="logo fl"></div></a>
			<a href=""><div class="ad_top fl"></div></a>
			<div class="nav fl">
				<ul id="fenlei1">
					
				</ul>
			</div>
			<div class="search fr">
				<form onsubmit="return false" method="post">
					<div class="text fl">
						<input type="text" class="shuru" name="name"  placeholder="鬼王酒吞童子&nbsp;鬼王风范尽显无疑">
					</div>
					<div class="submit fl">
						<input type="submit" class="sousuo" name="select" value="搜索"
						onclick="sel()" />
					</div>
					<div class="clear"></div>
				</form>
				<div class="clear"></div>
			</div>
		</div>

	<script type="text/javascript">
		//根据关键字搜索
		function sel(){
			var name = $("input[name='name']").val();
			console.log(name)
			ajax({name:name},'/product/getOne.do','json',function(data){
				console.log(data)
				if(data=="0"){
					layer.msg("请输入关键字！",{
						time:1000
					})
				}else{
					toJsp('/web/front/details.jsp?code=' + data.code);
				}		
			})
		}
		
		function dingdan(){
			toJsp('/web/front/order.jsp');
		}
		
		//注销
		function toLogout(){
			openConfirm(function(index){
				toJsp('/user/userOut.do');
			},"是否进行注销？");
		}
	</script>

</body>
</html>